<?php
/**
 * Created by PhpStorm.
 * User: FoxxxZhu
 * Date: 2017/12/26
 * Time: 17:07
 */

namespace Forxx;

use Lavender\Dao\RedisTable;
class RedisCounter extends RedisTable{
    protected $table = 'common';
    protected $prefix = "counter";

    public function increment($id,$num = 1)
    {
        $key = $this->makeKey($id);
        return $this->incrby($key,$num);
    }

    public function get($id)
    {
        $key = $this->makeKey($id);
        echo $key;
        $num = $this->get_handle()->get($key);
        return intval($num);
    }
}